package com.powerunion.datacollection.service;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.powerunion.datacollection.common.SystemException;
import com.powerunion.datacollection.dao.BaseUserDao;
import com.powerunion.datacollection.dao.DaoFactory;
import com.powerunion.datacollection.model.User;
import com.powerunion.util.log.LogHelper;

public class UserManager {
	private static Logger logger = LogHelper.getInstance().getLogger(UserManager.class);
	private BaseUserDao dao = null;
	public UserManager() {
		super();
		this.dao = (BaseUserDao)DaoFactory.getInstance().getDao(BaseUserDao.class);
	}
	
	 public User getUser(String userCode)throws Exception {
			//参数为空
			if(StringUtils.isEmpty(userCode)) {
				String[] args = { "userCode" };
				// 打印错误日志
				StringBuffer msglog = new StringBuffer(
						"empty invoke parameter userCode NULL ");
				logger.error(msglog.toString());
				throw new SystemException("error.common.parameter.empty", args);
			}
		 return dao.getUser(userCode);
	 }
	
}
